const Category = require("../../dbs/models/category");

module.exports = {
  get crumbs() {
    return async ctx => {
      // 返回广州市的数据
      let res = await Category.findOne();
      if (res) {
        return (ctx.body = {
          code: 0,
          msg: "获取成功",
          data: {
            city: res.city,
            area: res.area,
            category: res.category
          }
        });
      } else {
        ctx.throw(400);
      }
    };
  }
};
